package com.edu.d9_map_impl;

import com.edu.d1_set.Student;

import java.util.HashMap;
import java.util.Map;

public class HashMapDemo {
    /**
     * hashmap的去重复原理和hashset类似，map集合去重复是根据键来去重复的
     */
    public static void main(String[] args) {
        Map<Student,String> hashMap = new HashMap<>();
        Student s1=new Student("坤坤",20,'男');
        Student s2=new Student("坤坤",20,'男');
        Student s4=new Student("小孩儿",99,'男');
        Student s5=new Student("大人",33,'男');
        Student s3=new Student("陈鑫",22,'女');
        hashMap.put(s1,"北京");
        hashMap.put(s2,"上海");
        hashMap.put(s3,"广州");
        hashMap.put(s4,"云南");
        hashMap.put(s5,"南京");
        System.out.println(hashMap);
    }
}
